<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="ProductCreateDlg" widgetVar="ProductCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateProductTitle}" closeOnEscape="true">

            <h:form id="ProductCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2">

                        <p:outputLabel value="#{bundle.CreateProductLabel_productId}" for="productId" />
                        <p:inputText id="productId" value="#{productController.selected.productId}" title="#{bundle.CreateProductTitle_productId}" required="true" requiredMessage="#{bundle.CreateProductRequiredMessage_productId}"/>

                        <p:outputLabel value="#{bundle.CreateProductLabel_amountAvailaible}" for="amountAvailaible" />
                        <p:inputText id="amountAvailaible" value="#{productController.selected.amountAvailaible}" title="#{bundle.CreateProductTitle_amountAvailaible}"/>

                        <p:outputLabel value="#{bundle.CreateProductLabel_userId}" for="userId" />
                        <p:selectOneMenu id="userId" value="#{productController.selected.userId}" required="true" requiredMessage="#{bundle.EditProductRequiredMessage_userId}" converter="userConverter">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{userController.items}"
                                           var="userIdItem"
                                           itemValue="#{userIdItem}"
                                           itemLabel="#{userIdItem.userId.toString()}"
                                           />

                        </p:selectOneMenu>

                        <p:outputLabel value="#{bundle.CreateProductLabel_flight}" for="flight" />
                        <p:selectOneMenu id="flight" value="#{productController.selected.flight}"  converter="flightConverter">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{flightController.items}"
                                           var="flightItem"
                                           itemValue="#{flightItem}"
                                           itemLabel="#{flightItem.flightId.toString()}"
                                           />

                        </p:selectOneMenu>

                        <p:outputLabel value="#{bundle.CreateProductLabel_hotel}" for="hotel" />
                        <p:selectOneMenu id="hotel" value="#{productController.selected.hotel}"  converter="hotelConverter">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{hotelController.items}"
                                           var="hotelItem"
                                           itemValue="#{hotelItem}"
                                           itemLabel="#{hotelItem.hotelId.toString()}"
                                           />

                        </p:selectOneMenu>

                        <p:outputLabel value="#{bundle.CreateProductLabel_excursion}" for="excursion" />
                        <p:selectOneMenu id="excursion" value="#{productController.selected.excursion}"  converter="excursionConverter">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{excursionController.items}"
                                           var="excursionItem"
                                           itemValue="#{excursionItem}"
                                           itemLabel="#{excursionItem.excursionId.toString()}"
                                           />

                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{productController.saveNew}" value="#{bundle.Save}" update="display,:ProductListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,ProductCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="ProductCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
